// 第一种，所有模块都用到jQuery的时候

// define(['jquery'],function(){
// 	return{
// 		change:function(){
// 			$('body').css('background','red');
// 		},
// 		show:function(){
// 			alert(1);
// 		},
// 		show2:function(){
// 			alert(2);
// 		}
// 	}
// })


// 第一种，只有少数模块都用到jQuery的时候，例下面只有change用到jquery
define(['jquery'],function(){
	return{
		// change:function(){
		// 	require(['jquery'],function(){
		// 		$('body').css('background','red');
		// 	})
		// },
		// show:function(){
		// 	alert(1);
		// },
		// show2:function(){
		// 	alert(2);
		// }

		// 首页头部第一个轮播
		index:function(){
			$(function(){
				var aa = new Date().getTime();
				var dddd = '2018-4-1 0:0:0';
				var bb = new Date(dddd).getTime();
				var cc = new Date('2018-10-2 0:0:0').getTime();
				if(aa>bb && aa<cc){
					alert("在区间内");
				}else{
					alert("不在")
				}
			});
		},
		com_left_nav:function(){
			$('.com-left-nav .item .head').click(function(){
				$('.com-left-nav .item .head').removeClass('head-act');
				$('.com-left-nav .item .bod').removeClass('bod-act');
				$(this).addClass('head-act');
				$(this).next().addClass('bod-act');
			})
		},
		index_banner:function(){
			require(['swiper'],function(){
				var swiper1 = new Swiper('.swiper-container1', {
			        pagination: '.swiper-pagination1',
        			paginationClickable: true,
			        spaceBetween: 30,
			        effect : 'fade',
					fade: {
  					crossFade: false,
					},
			        autoplay: 4000
			    });
			    var swiper2 = new Swiper('.swiper-container2', {
			        pagination: '.swiper-pagination2',
        			paginationClickable: true,
			        // effect : 'fade',
					// fade: {
  			// 		crossFade: false,
					// },
			        autoplay: 4000,
			        loop: true
			    });
			    var swiper3 = new Swiper('.swiper-container3', {
			        slidesPerView: 4,
			        paginationClickable: true,
			        spaceBetween: 30,
			        prevButton:'.swiper-button-prev',
					nextButton:'.swiper-button-next'
			    });
				var swiper333 = new Swiper('.swiper-container333', {
					slidesPerView: 3,
					paginationClickable: true,
					spaceBetween: 8,
					prevButton:'.swiper-button-prev',
					nextButton:'.swiper-button-next',
					autoplay: 4000,
					loop: true
				});
				var window_width = $(window).width();
				var slide_number = 4;
				var slide_space = 25;
				if (window_width >= 640){
					slide_number = 4;
					slide_space = 25;
				}else{
					slide_number = 2;
					slide_space = 10;
				}
			    var swiper4 = new Swiper('.swiper-container4', {
			        slidesPerView: slide_number,
			        paginationClickable: true,
			        spaceBetween: slide_space,
					autoplay: 4000,
					loop: true,
			        grabCursor: true,
			        nextButton: '.swiper-button-next2',
			        prevButton: '.swiper-button-prev2'
			    });

			    var swiper44 = new Swiper('.swiper-container44', {
			        slidesPerView: slide_number,
			        paginationClickable: true,
			        spaceBetween: slide_space,
					autoplay: 4000,
					loop: true,
			        grabCursor: true,
			        nextButton: '.swiper-button-next44',
			        prevButton: '.swiper-button-prev44'
			    });
			    var swiper5 = new Swiper('.swiper-container5', {
			        pagination: '.swiper-pagination5',
        			paginationClickable: true,
					autoplay: 4000,
					loop: true,
			        nextButton: '.swiper-button-next1',
			        prevButton: '.swiper-button-prev1'
			    });
			});
			$(".btn-box span").click(function(){
				var aa = $(this).index();
				$(".btn-box span").removeClass("span-act");
				$(this).addClass("span-act");
				$(".changebox .box").removeClass("box-act");
				$(".changebox .box").eq(aa).addClass("box-act");
			})
		},
		com_footer:function(){
			$('.com-footer .top-nav .list').click(function(){
				$('.com-footer .top-nav .list').removeClass('list-act');
				$(this).addClass('list-act');
				$('.com-footer .down-box .item').removeClass('item-act');
				$('.com-footer .down-box .item').eq($(this).index()).addClass('item-act');
			})
			$("#gotop").click(function() {
		        $("html,body").animate({scrollTop:0}, 800);
		  	}); 
		  	$(window).on('scroll', function () {/*当滚动条的垂直位置大于浏览器所能看到的页面的那部分的高度时，回到顶部按钮就显示 */  
			    if ($(window).scrollTop() > 100)  
			        $("#gotop").fadeIn();  
			    else  
			        $("#gotop").fadeOut();  
			});  
			$(window).trigger('scroll');/*触发滚动事件，避免刷新的时候显示回到顶部按钮*/

			$('.m-menu-btn').click(function(){
				if($('.iicon').hasClass('icon-ego-menu')){
					$('.m-nav-box').slideToggle();
					$('.iicon').removeClass('icon-ego-menu').addClass('icon-htmal5icon21')
				}else{
					$('.m-nav-box').slideToggle();
					$('.iicon').removeClass('icon-htmal5icon21').addClass('icon-ego-menu')
				}
			})
		},
		teacher:function(){
			require(['swiper'],function(){
				var swiper = new Swiper('.swiper-container2', {
			        pagination: '.swiper-pagination2',
			        slidesPerView: 4,
			        paginationClickable: true,
			        spaceBetween: 25,
			        autoplay: 5000
			    });
			})
		},
		index_partner:function(){
			require(['swiper'],function(){
				var swiper2 = new Swiper('.swiper-container2', {
			        slidesPerView: 2,
			        slidesPerColumn: 4,
			        paginationClickable: true,
			        spaceBetween: 20,
			        autoplay: 4000
			    });
			})
		},
		img:function(){
			require(['baguetteBox'],function(){
				$(function(){
				  baguetteBox.run('.baguetteBox');
				});
			})
		},
		dhh:function(){
			require(['wow'],function(){
				$(function(){
				  if (!(/msie [6|7|8|9]/i.test(navigator.userAgent))){
						new WOW().init();
					};
				});
			})
		},
		nav:function(){
			require(['swiper'],function() {
				var mySwiper999 = new Swiper('.swiper-container999',{
					paginationClickable: true,
					slidesPerView: 'auto',
					spaceBetween: 5
				})
			})
		}
		
	}
})